package com.zq.test;

import java.util.ArrayList;
import java.util.List;

import com.java.common.lock.SynLock;
import com.java.common.pack.MPack;
import com.java.common.page.AbstractPage;
import com.java.common.page.PageSortUtils;
import com.java.publics.interfaces.IDataIO;
import com.java.publics.interfaces.IOKeeper;
import com.java.publics.interfaces.IPage;
import com.java.utils.net.IOUtils;
import com.java.vos.PageSort;
import com.java.vos.VData;
import com.mohe.mobile.mx.vo.Theme;

public class CommunityPagenation extends AbstractPage{

	private String SERVER_ADDR = "192.168.2.28/30000";
	private long userKey = 1000;
	
	public CommunityPagenation(Class<?> arg0, int arg1) {
		super(arg0, arg1);
	}

	@Override
	public void clearTop() {
		
	}

	@Override
	public <T extends VData> void doSaveDataList(List<T> arg0, Class<?> arg1) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public IOKeeper getIOKeeper() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public <T extends VData> List<T> loadDataListFromLocal(List<Long> arg0, Class<?> arg1) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public <T extends VData> int loadDataListFromRemote(SynLock arg0, List<Long> arg1, List<T> arg2, int arg3,
			Class<?> arg4) {
		
		IDataIO io = IOUtils.getDataIO(SERVER_ADDR);
		List<Theme> dataList = new ArrayList<Theme>();
		PageSortUtils.getDataList(arg1, dataList, arg3, arg4, io, userKey);
		arg2.addAll((List<T>)dataList);
		return IPage.SUCCESS;
	}

	@Override
	public int loadSortListFromLocal(List<PageSort> arg0, Class<?> arg1, int arg2, int arg3, int arg4) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int loadSortListFromRemote(SynLock arg0, List<PageSort> arg1, int arg2, int arg3, int arg4) {
		
		MPack mPack = new MPack();
		mPack.setFromId(userKey);
		
		IDataIO io = IOUtils.getDataIO(SERVER_ADDR);
		List<PageSort> sortList = new ArrayList<PageSort>();
		PageSortUtils.getPageSortList(sortList, arg2, arg3, arg4, io, userKey, mPack);
		return IPage.SUCCESS;
	}

}
